<?php

class Site_PageController extends Fengqiaoju_Controller_Action {

	public function init() {

		parent::init ();
		$this->view->site_id = $this->site_id = $this->_request->getParam ( 'site_id' );
		$this->site_seo_name = $this->_request->getParam ( 'site_seo_name' );
		$this->view->model_id = $this->_request->getParam ( 'model_id' );
		$this->view->article_id = $this->_request->getParam ( 'article_id' );
		$this->view->page_id = $this->_request->getParam ( 'page_id' );
	}

	public function indexAction() {

		$modelObject = new Site_Models_Model ();
		$pageObject = new Site_Models_Page ();
		$siteObject = new Site_Models_Site ();
		
		//当前模块信息
		$where = '';
		$where = "model_id=" . intval ( $this->view->model_id );
		$this->view->modelInfo = $modelObject->fetchRow ( $where );
		
		if (! $this->view->modelInfo ['model_id']) {
			$this->message ( '您访问的模块不存在' );
		}
		
		//头部导航菜单
		$where = '';
		$where = 'site_id = ' . intval ( $this->view->modelInfo ['site_id'] );
		$this->view->modelList = $modelObject->fetchAll ( $where );
		
		//小站信息
		$where = '';
		$where = "site_id=" . intval ( $this->view->modelInfo ['site_id'] );
		$this->view->siteInfo = $siteObject->fetchRow ( $where );
		
		//页面内容
		$where = '';
		$where = "model_id=" . intval ( $this->view->model_id );
		$this->view->pageInfo = $pageObject->fetchRow ( $where );
		
		$this->view->title = $this->view->pageInfo ['page_name'] . '_' . $this->view->modelInfo ['model_name'] . '_' . $this->view->siteInfo ['site_name'] . "-" . $this->config ['site'] ['title'];
		$this->view->keywords = $this->view->pageInfo ['page_name'] . ',' . $this->view->modelInfo ['model_name'] . ',' . $this->view->siteInfo ['site_name'] . "," . $this->config ['site'] ['title'];
	
	}
}